Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum


  

PreviousPrevious NextNext

Success
~Samuel Nonfoopuloden 3.Feb.03 02:40 PM a Web browser
Domino Designer 6.0 Windows NT


For anyone interested, I have finally managed to convert a simple SVG into a JPEG using Batik as part of a Java agent.

I tried using a string of XML as the SVG source, rather than a file, and this threw up some new error messages. It seems that the problem was related to the DOCTYPE definition in the sample files (supplied with Batik!).

The samples used this definition:

<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 03December 1999//EN"
"http://www.w3.org/Graphics/SVG/SVG-19991203.dtd">

But when I replaced it with the one listed on the SVG 1.1 recommendation on W3.org, it worked:

<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

For the record, here is the successful agent code, which creates a JPEG version of a very simple SVG image. I imported all the Batik JAR files (plus the crimson parser) into the agent itself, and no longer have a 'JavaUserClasses' line in my notes.ini file:

import lotus.domino.*;
import java.io.*;
import org.apache.batik.transcoder.image.JPEGTranscoder;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;

public class JavaAgent extends AgentBase {

public void NotesMain() {

try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();

System.out.println(System.getProperty( "java.class.path" ));

String svgInput ="<?xml version=\"1.0\" encoding=\"iso-8859-1\"?><!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\"><svg xml:space=\"preserve\" width=\"5.5in\" height=\"2in\"><rect style=\"fill:blue;\" width=\"250\" height=\"100\"/></svg>";

BufferedReader br = new BufferedReader(new StringReader(svgInput));

// create a JPEG transcoder
JPEGTranscoder t = new JPEGTranscoder();
// set the transcoding hints
t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY,
new Float(.8));

// create the transcoder output
OutputStream ostream = new FileOutputStream("C:\\Batik\\xml-batik\\samples\\out.jpg");
TranscoderOutput output = new TranscoderOutput(ostream);
// save the image

t.transcode(new TranscoderInput(br),output);

// flush and close the stream then exit
ostream.flush();
ostream.close();

System.exit(0);

} catch(Exception e) {
e.printStackTrace();
}
}
}




org.w3c.dom.DOMImplementation (~Samuel Nonfoop... 4.Dec.02)
. . RE: org.w3c.dom.DOMImplementation (~Samuel Nonfoop... 4.Dec.02)
. . RE: org.w3c.dom.DOMImplementation (~Olga Chuluburo... 29.Jan.03)
. . . . RE: org.w3c.dom.DOMImplementation (~Samuel Nonfoop... 29.Jan.03)
. . . . . . Success (~Samuel Nonfoop... 3.Feb.03)


Document Options






  Document options
Print this pagePrint this page

Search this forum

Forum views and search


  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Category
Platform
Release
Advanced search

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS